package com.xiao.dao;


import com.xiao.pojo.Classinfo;
import com.xiao.pojo.Classrelation;
import com.xiao.pojo.Subject;
import com.xiao.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 用户模块
 * 登录注册
 */
@Repository
public interface UserMapper {

    List<User>  findAllUser();

    //根据uid查询用户信息
    User findUserByUid(long uid);

    //根据uname查询用户信息
    User findUserByUname(String uname);

    //添加用户
    int AddUser(@Param("uname") String uname,@Param("upassword")String upassword);

    //根据uname和upassword判断用户是否存在
    User findUserByUnameAndUpwd(@Param("uname") String uname,@Param("upassword")String upassword);

    //根据uid完善昵称nickname、年级gradeid、学科subjectid、身份identity
    int PerfectUserInfo(User user);

    //根据uid查询classid
    List<Classinfo> findClassinfoByUid(long uid);

    //根据classid查询班级信息
    Classinfo findClassByClassid(long classid);

    //根据uid与classid加入班级关联表
    int AddClassrelation(Classrelation classrelation);

    //根据uid与classid查询班级关联表有无已存在信息
    Classrelation FindClassrelationByUidAndCid(@Param("uid") long uid,@Param("classid") long classid);

    //根据uid查询用户身份
    String FindIdentityByUid(long uid);

    //跟据uid和classid查询该成员班级权限
    String FindPowerByUidAndClassid(@Param("uid") long uid,@Param("classid") long classid);

    //查询所有学科
    List<Subject> FindAllSubject();







}
